<?php 


$fileArr = current($_FILES);

$fileList = array();

foreach ($fileArr as $key => $value) {
	foreach ($value as $k => $v) {
		$fileList[$k][$key]=$v;
	}
}

foreach ($fileList as $key =>  $file) {
	// 获取临时文件和原文件名
	$tmp_name = $file['tmp_name'];
	$name = $file['name'];

	// 判断是否合法上传文件
	if(!is_uploaded_file($tmp_name)) exit;

	//设置上传目录
	$path = "./Upload/";

	// 判断创建目录
	is_dir($path) || mkdir($path);

	// 组合新名
	$newName = uniqid($key).substr($name,strrpos($name, '.'));

	// 组合新路径
	$newPath = $path.$newName;

	// 移动临时文件
	move_uploaded_file($tmp_name,$newPath);
}







 ?>